<template>
  <div class="block">
    <el-carousel trigger="click" height="600px">
      <el-carousel-item v-for="item in 3" :key="item">
      </el-carousel-item>
    </el-carousel>
    <router-view></router-view>
    <div class="left">
      <div class="container">
      <img src="../../../images/侧边栏.png" alt="">
    </div>
    </div>
    <br>
    <br>
    <br>
    <br> 
    <el-row type="flex" class="row-bg" justify="space-around" style="flex-wrap:wrap">
        <el-col :span="5" v-for="(product, index) in products" :key="product.id" style="margin-bottom: 20px;">
        <el-card :body-style="{ padding: '0px' }">
          <img :src="'/products/' + product.imgPath" 
          class="image">
          <div style="padding: 14px;">
            <span>{{product.productName}}</span>
            <p class="des">{{product.description}}</p>
            <div class="bottom clearfix">
               <time class="time"></time>
              <el-button type="text" class="button" @click="goDetail(product.id)">查看详情</el-button>
        </div>
      </div>
    </el-card>
  </el-col>
</el-row>
<div class="section4">
 <div class="pinglun">
    <h1>-热门评论-</h1>
    <div class="pinglun1">
        <div class="n1">
          <img src="../../../images/热门评论1.jpg" alt="">
          <label>156****2315&nbsp;&nbsp;2022-07-09<br>
                 很好吃，下次再选其他口味！
          </label>
        </div>
        <div class="n2">
          <img src="../../../images/热门评论2.jpg" alt="">
          <label>176****2964&nbsp;&nbsp;2022-06-28<br>
                 不要太好吃，爱芒果的我，我爱芒果~
          </label>
        </div>
        <div class="n3">
          <img src="../../../images/热门评论3.jpg" alt="">
          <label>155****0642&nbsp;&nbsp;2022-06-22<br>
                 非常惊艳，颜色鲜艳，色彩丰富~
          </label>
        </div>
        <div class="n4">
          <img src="../../../images/热门评论4.jpg" alt="">
          <label>139****8465&nbsp;&nbsp;2022-07-18<br>
                我们几个女生一起下午茶很开心，推荐！
          </label>

        </div>
    </div>
</div>
</div>
<footer>
<div class="footer">
            <img class="footer-logo" src="../../../images/logo.png" height="23" width="200" alt="">
            <div class="footer-nav">
                <a>诺心公告</a>
                <span>|</span>
                <a>关于诺心</a>
                <span>|</span>
                <a>客服服务</a>
                <span>|</span>
                <a>生产经营资质</a>
                <span>|</span>
                <a>公告专区</a>
            </div>
            <div class="footer-icon">
                <a href="http://weibo.com/21cake" target="_blank">
                    <img src="../../../images/footericon-01.png">
                </a>
                <a class="footer-weixin">
                    <div class="footer-erweima footer-weixin-erweima">
                        <img src="../../../images/erweima.png">
                    </div>
                    <img src="../../../images/footericon-02.png">
                </a>
                <a class="footer-app">
                    <div class="footer-erweima footer-app-erweima">
                        <img src="../../../images/erweima.png">
                    </div>
                    APP
                </a>
            </div>
            <div class="footer-text">
                <span>订购专线：4001-578-578（服务时间 09:00–21:00）</span>
                <span>客服电话：021-23099721（全国） | services@lecake.com（邮箱）</span>
                <span>杭州/广州：提前5小时预订；北京：提前6小时预订；上海：提前5.5-6小时预订；天津/苏州/无锡/深圳：提前8小时预订（部分偏远地区除外，当日22点以后订单，于次日8点开始审核） </span>
                <span>当日蛋糕配送截止下单时间：北京：16:50；上海：16:30；杭州/广州：13:50；天津：10:30；苏州/无锡/深圳：11:00</span>
                <span>网站注册公司名称: 诺心食品（上海）有限公司  地址: 上海市徐汇区虹漕路68号锦和中心7楼A、C单元 </span>
            </div>
            <div class="footer-copyright">
                <span>Copyright© 诺心leCake蛋糕官网商城 2010-2022, 版权所有 <a style="color: #9a9a9a" target="_blank" href="https://beian.miit.gov.cn/#/Integrated/index">沪ICP备10211730号-2</a></span>
            </div>
        </div>
      </footer>
  </div>
</template>
<style lang="scss" scoped>
.section4{
    width: 100%;
    height: 300px;
}
label{
  font-size: 16px;
  color: white;
  font-family: "微软雅黑";
  position:relative;
  top: -50px;
  left:20px;
  z-index: 1;
}
.section4 .pinglun{
    width: 1510px;
    height: 30px;
    background-color: #fff;
    margin:10px auto 20px;
}
.pinglun h1{
    text-align: center;
    font-size: 20px;
}
.section4 .pinglun1{
    width: 1510px;
    height: 240px;
    background-color: #fff;
    position: relative;
    left: 20px;
    display: inline;
}
.n1,.n2,.n3,.n4{
    width: 350px;
    height: 240px;
    display: inline-block;
    border-radius: 20px;
    overflow: hidden;
    margin-left: 15px;
}
.n1 img{
    border-radius: 20px;
    transition:all 1s;
}
.n1:hover img{
    transform: scale(1.2);
  }
.n2 img{
    border-radius: 20px;
    transition:all 1s;
}
.n2:hover img{
    transform: scale(1.2);
  }
.n3 img{
    border-radius: 19px;
    transition:all 1s;
}
.n3:hover img{
    transform: scale(1.2);
  }
.n4 img{
    border-radius: 19px;
    transition:all 1s;
}
.n4:hover img{
    transform: scale(1.2);
  }
.left{
    width: 314px;
    height: 314px;
    position: absolute;
    left: -190px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
   }
   .container{
   width: 400px;
   height: 300px;
   transform-style: preserve-3d;
   transition: 1s linear;
   }
   .left:hover .container{
        transform:translateX(150px);
   }
  .row-bg{
    width: 1200px;
    margin: 0 auto;
  }
  ::v-deep .el-carousel__container {
    height: 600px;
  }
   ::v-deep  .el-carousel__indicator--horizontal{
    position: relative;
    left: 10%;
   }
   .productName{
    text-align: center;
    font-size: 18px;
    font-weight: 700;
  }
  .des{
    color: #949494;
    font-size: 14px;
  }
   .black{
    width: 100%;
   }
  .el-carousel__item:nth-child(1n) {
    background-image: url(../../../images/轮播图四.jpg);
  }
  /* .el-carousel__item:nth-child(2n) {
    background-image: url(../../../images/轮播二.jpg);
  } */
  .el-carousel__item:nth-child(3n) {
    background-image: url(../../../images/轮播一.jpg);
  }

  .el-carousel__item:nth-child(2n) {
    background-image: url(../../../images/轮播五.jpg);
  } 
  .section1,.section2{
    width: 400px;
    height: 400px;
  }
  .image {
    width: 100%;
    display: block;
    position: relative;
    right: 5px;
  }
  footer .footer {
    background: #333;
    padding: 50px 0 0 0;
    position: relative; }
    footer .footer .footer-logo {
      display: block;
      margin: 0 auto; }
    footer .footer .footer-nav {
      text-align: center;
      color: #fff;
      margin: 25px 0; }
      footer .footer .footer-nav a {
        color: #fff;
        display: inline-block;
        margin: 0 50px;
        cursor: pointer; }
    footer .footer .footer-icon {
      text-align: center; }
      footer .footer .footer-icon .footer-erweima {
        position: absolute;
        display: block;
        height: 120px;
        width: 120px;
        left: 50%;
        margin-left: 42px;
        top: 15px;
        overflow: hidden;
        opacity: 1; }
        footer .footer .footer-icon .footer-erweima img {
          height: 100px;
          width: 100px;
          position: absolute;
          margin: 5px;
          top: 100%;
          left: 0;
          border: 10px solid #fff;
          transition: .5s; }
      footer .footer .footer-icon a {
        display: inline-block;
        border-radius: 25px;
        cursor: pointer;
        height: 50px;
        width: 50px;
        background: #494949;
        margin: 0 25px;
        font-size: 16px;
        color: #fff;
        line-height: 50px;
        text-align: center;
        vertical-align: middle; }
        footer .footer .footer-icon a img {
          height: 30px;
          margin: 10px; }
        footer .footer .footer-icon a .footer-weixin-erweima {
          margin-left: -64px; }
        footer .footer .footer-icon a .footer-app-erweima {
          margin-left: 42px; }
      footer .footer .footer-icon .footer-erweima:hover {
        opacity: 0; }
      footer .footer .footer-icon .footer-weixin:hover img {
        top: 0; }
      footer .footer .footer-icon .footer-app:hover img {
        top: 0; }
    footer .footer .footer-text {
      color: #9a9a9a;
      text-align: center;
      margin-top: 25px;
      line-height: 18px;
      font-size: 10px; }
      footer .footer .footer-text span {
        display: block; }
      footer .footer .footer-text span:first-child {
        font-weight: bold; }
    footer .footer .footer-copyright {
      margin: 0 auto;
      border-top: 1px solid #616161;
      margin-top: 15px;
      text-align: center;
      padding-bottom: 15px;
      font-size: 10px;
      padding-top: 12px; }
      footer .footer .footer-copyright span {
        color: #9a9a9a;
        line-height: 1.5em; }
        footer .footer .footer-copyright span a {
          cursor: pointer; }
  
</style>
<script>
  export default {
    name: 'HomeView',
    data() {
       return {
        products:[]
    }
  },
    methods:{
       goDetail(pId){
        this.$router.push('/detail?productId=' + pId)
       }
    },
    created(){
        this.axios.get('/api/getAllProducts')
        .then(res=>{
          console.log('res:',res.data.data)
          this.products = res.data.data
        })
    } }
  </script>